fix: detect xlings package path and fallback MCPP_HOME to ~/.mcpp#60
Merged
Conversation
When mcpp is installed via `xlings install mcpp`, the binary lives at ~/.xlings/data/xpkgs/xim-x-mcpp/<ver>/bin/mcpp. The previous home_dir() detected bin/ and used the grandparent (the xpkgs package directory) as MCPP_HOME, creating a nested xlings sandbox that broke toolchain installation and lost installed toolchains on mcpp upgrade. Now home_dir() checks for the data/xpkgs ancestor pattern and falls back to ~/.mcpp/ (same behavior as CI with explicit MCPP_HOME). Also extract default_mcpp_home() with unified Windows (%USERPROFILE%) and POSIX ($HOME) fallback logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
home_dir()to detect when mcpp runs from a xlings package (data/xpkgs/xim-x-mcpp/) and fallback to~/.mcpp/instead of creating a nested sandboxdefault_mcpp_home()with unified Windows (%USERPROFILE%) and POSIX ($HOME) fallbackProblem
When mcpp is installed via
xlings install mcpp,home_dir()treats the xlings package directory as MCPP_HOME, creating a nested xlings sandbox (~/.xlings/.../mcpp/0.0.20/registry/data/xpkgs/). This causesmcpp toolchain install llvmto fail with "xpkg payload missing" because xlings doesn't properly handle the deeply nested XLINGS_HOME.Fix
Check for
data/xpkgsancestor pattern in the binary path → fallback to~/.mcpp/(same as CI behavior with explicitMCPP_HOME).Test plan
xpkgsancestor)targetancestor still detected)xlings install mcpp→mcpp toolchain install llvmworks with~/.mcpp/as HOME